import request from '@/utils/request'

// 获取列表
export function getRoleList(params) {
  return request({
    url: '/manager/admin_Rbac/roleList',
    method: 'get',
    params
  })
}

export function reqAddRole(data) {
  return request({
    url: '/manager/admin_Rbac/roleAdd',
    method: 'post',
    data
  })
}

export function reqEditRole(data) {
  return request({
    url: '/manager/admin_Rbac/roleEdit',
    method: 'post',
    data
  })
}

export function reqRoleAllMenu() {
  return request({
    url: '/manager/admin_Rbac/getMenus',
    method: 'get',
  })
}

export function reqGetRoleMenuList(id) {
  return request({
    url: '/manager/admin_Rbac/getMenuByRole?id=' + id,
    method: 'get',
  })
}
export function reqGetRoleInfo(id) {
  return request({
    url: '/manager/admin_Rbac/getRoleById?id='+id,
    method: 'get',

  })
}

export function roleDelete(id) {
  return request({
    url: '/manager/admin_Rbac/roleDelete?id='+id,
    method: 'get',
  })
}
export function roleDeleteAll(data) {
  return request({
    url: '/manager/admin_Rbac/roleDeleteByIds',
    method: 'post',
    data
  })
}

export function roleStatusClose(id) {
  return request({
    url: '/manager/admin_Rbac/roleClose?id='+id,
    method: 'get',

  })
}

export function roleStatusOpen(id) {
  return request({
    url: '/manager/admin_Rbac/roleOpen?id='+id,
    method: 'get',
  })
}

// --------------------- 管理员列表 -----------------
export function getUserIndex(params) {
  return request({
    url: '/manager/admin_Rbac/userList',
    method: 'get',
    params
  })
}

export function userAdd(data) {
  return request({
    url: '/manager/admin_Rbac/userAdd',
    method: 'post',
    data
  })
}

export function userEdit(data) {
  return request({
    url: '/manager/admin_Rbac/userEdit',
    method: 'post',
    data
  })
}

export function getUserInfo(params) {
  return request({
    url: '/manager/admin_rbac/getUserById',
    method: 'get',
    params
  })
}

// 暂停
export function userDel(data) {
  return request({
    url: '/manager/admin_Rbac/userClose',
    method: 'post',
    data
  })
}

export function openStatus(data) {
  return request({
    url: '/manager/admin_Rbac/userOpen',
    method: 'post',
    data
  })
}

